<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<input type="text" name="" id="inp">
<button>计算</button>
</body>
<script>
    let inp = document.querySelector("input")
    let btn = document.querySelector("button")
let res=  btn.onclick= function jisuan(){
        let inpValue = inp.value;
      
            if(inpValue!=''){
            let newinpValue = inpValue.split('/')
            console.log(newinpValue.length);
            if(newinpValue.length == 1){
                return newinpValue[0]
            }else if(newinpValue.length > 1){
                let itemvalue = 0
                newinpValue.forEach(item => {
                    itemvalue=itemvalue+item*1
                });
                return itemvalue
            }else{
                return '空'
            }
        }else{
                return '空'
            }
        
    }
   console.log(res);
</script>
</html>   